<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * modelosxingresos filter form base class.
 *
 * @package    gescell
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BasemodelosxingresosFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'modelos_id'         => new sfWidgetFormPropelChoice(array('model' => 'modelos', 'add_empty' => true)),
      'imei'               => new sfWidgetFormFilterInput(),
      'ordenesservicio_id' => new sfWidgetFormPropelChoice(array('model' => 'ordenesservicio', 'add_empty' => true)),
      'sf_guard_user'      => new sfWidgetFormPropelChoice(array('model' => 'sfGuardUser', 'add_empty' => true)),
      'fechareparacion'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'fechaentrega'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'reparado'           => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'garantia'           => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'entregado'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'entregado_a'        => new sfWidgetFormFilterInput(),
      'periodo_garantia'   => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'modelos_id'         => new sfValidatorPropelChoice(array('required' => false, 'model' => 'modelos', 'column' => 'id')),
      'imei'               => new sfValidatorPass(array('required' => false)),
      'ordenesservicio_id' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'ordenesservicio', 'column' => 'id')),
      'sf_guard_user'      => new sfValidatorPropelChoice(array('required' => false, 'model' => 'sfGuardUser', 'column' => 'id')),
      'fechareparacion'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'fechaentrega'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'reparado'           => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'garantia'           => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'entregado'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'entregado_a'        => new sfValidatorPass(array('required' => false)),
      'periodo_garantia'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('modelosxingresos_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'modelosxingresos';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'modelos_id'         => 'ForeignKey',
      'imei'               => 'Text',
      'ordenesservicio_id' => 'ForeignKey',
      'sf_guard_user'      => 'ForeignKey',
      'fechareparacion'    => 'Date',
      'fechaentrega'       => 'Date',
      'reparado'           => 'Boolean',
      'garantia'           => 'Boolean',
      'entregado'          => 'Boolean',
      'entregado_a'        => 'Text',
      'periodo_garantia'   => 'Number',
    );
  }
}
